/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function getEndOfMonth(year, month) {

    var days = [0, 31, 28, 31, 30, 31, 30,
        31, 31, 30, 31, 30, 31];

    if (month === 2 && isLeapYear(year)) {
        return 29; // last day of Feb. in leap year
    } else {
        return days[ month];
    }
}

function isLeapYear(y) {
    if (y % 400 === 0 || (y % 100 != 0 && y % 4 == 0)) {
        return true;   // a leap year
    } else {
        return false;  // not a leap year
    }
}